package m202312.d05;

/**
 * @author haocongshun
 * @date 2023/12/05 18:13:24
 */

/**
 * 11. 盛最多水的容器
 */
public class Q11 {
    public int maxArea(int[] height) {
        int max = 0;
        int start = 0;
        int end = height.length - 1;
        while (start < end) {
            int c = (end - start) * Math.min(height[start], height[end]);
            max = Math.max(c, max);
            if (height[start] < height[end]) {
                start++;
            } else {
                end--;
            }
        }
        return max;
    }
}
